/*!
 * Copyright (C) 2020 - All Rights Reserved by
 * @author : ZhaoYanbo
 * @email  : zyb920@hotmail.com
 * @created: 2020-10-31
 * @version: 1.0.0.0
 *
 */

#ifndef GRAPHICSVIEW_H
#define GRAPHICSVIEW_H

#include <QGraphicsView>
#include <QGraphicsScene>
#include <QTimer>

class GraphicsView : public QGraphicsView
{
    Q_OBJECT
public:
    explicit GraphicsView(QWidget *parent = nullptr);

    ///
    /// \brief init
    /// \param round 几圈
    /// \param count 0-180平分个数
    ///
    void init(int round, int count);

private:
    void addItem(int round);

private slots:
    void doTimerOut();

protected:
    void resizeEvent(QResizeEvent *event) override;

private:
    QGraphicsScene *pScene = nullptr;
    QTimer *pTimer = nullptr;

    int mCount;
    int mRound;
    int mCurRound;
    double mAngle;
    const double mR; //圆环高度
    const double mR2;//内圆半径

    QGraphicsEllipseItem *mp_circleItem = nullptr;
};

#endif // GRAPHICSVIEW_H
